AnnieRoot.shootPeople = AnnieRoot.shootPeople || {};
AnnieRoot.shootPeople.DevilManager = class extends annie.Sprite {
    constructor() {
        super();
        let s = this;
        /*_a2x_need_start*//*_a2x_need_end*/
        annie.initRes(s, "shootPeople", "DevilManager");
    }

    /*获取恶魔方法*/
    static getEnemy() {
        var s = this,
            enemy;
        if (s.enemyPool.length > 0) {
            enemy = s.enemyPool.shift();
        } else {
            enemy = annie.getDisplay("shootPeople", "Devil");//生成小恶魔
        }
        return enemy;//返回小恶魔类实例
    };

    /**
     * 恶魔回收
     * @param enemy
     */
    static recoveryEnemy(enemy, type) {
        var s = this;
        if (!enemy) {
            throw new Error('enemy参数不能为空');
        }
        if (type) {
            var info = type.toString();
            if (!enemy[info].hasEventListener(annie.Event.END_FRAME)) {
                enemy[info].addEventListener(annie.Event.END_FRAME, function (e) {
                    enemy.visible = false;
                    enemy.gotoAndStop(1);
                    enemy.motion = "";
                    s.enemyPool.push(enemy);
                })
            }
        } else {
            enemy.visible = false;
            enemy.gotoAndStop(1);
            enemy.motion = "";
            s.enemyPool.push(enemy);
        }
    };
};
AnnieRoot.shootPeople.DevilManager.enemyPool = [];//恶魔池